package com.sc.VenusQueryBeta.model.vip;

import com.hengjun.kingstar.sdk.base.BaseModel;
import com.hengjun.kingstar.sdk.helper.RetrofitCreateHelper;
import com.hengjun.kingstar.sdk.helper.RxHelper;
import com.sc.VenusQueryBeta.api.Host;
import com.sc.VenusQueryBeta.api.account.AccountApi;
import com.sc.VenusQueryBeta.api.login.LoginApi;
import com.sc.VenusQueryBeta.contract.vip.MsgContract;
import com.sc.VenusQueryBeta.model.bean.account.msg.MsgListBean;
import com.sc.VenusQueryBeta.model.bean.login.QueryRegisBean;

import io.reactivex.Observable;

import static com.sc.VenusQueryBeta.api.Host.serverAddress;
import static com.sc.VenusQueryBeta.api.Host.serverPort;


/**
 * 推送的model
 * Created by Administrator on 2018/11/4.
 */

public class MsgModel extends BaseModel implements MsgContract.IMsgModel {
    public static MsgModel newInstance(){
        return new MsgModel();
    }

    /**
     * 查询注册服务器
     * @param id
     * @return
     */
    @Override
    public Observable<QueryRegisBean> queryRegisterServerSetting(String id) {
        return RetrofitCreateHelper.createApi(LoginApi.class,  Host.HostVGSestMessageserver).queryRegist(id).compose(RxHelper.<QueryRegisBean>rxSchedulerHelper());
    }

    /**
     * 推送列表
     * @param sendId
     * @param loginPort
     * @param loginUserId
     * @return
     */
    @Override
    public Observable<MsgListBean> getMsgList(String serverAddress, String projectName, int serverPort,String sendId, String loginPort, String loginUserId) {
        return RetrofitCreateHelper.createApi(AccountApi.class,  Host.HostVGSestMessageserver).getmsglist(sendId,loginPort,loginUserId).compose(RxHelper.<MsgListBean>rxSchedulerHelper());
//        return RetrofitCreateHelper.createApi(AccountApi.class,  Host.base+serverAddress+":"+serverPort+"/"+projectName+"/").getmsglist(sendId,loginPort,loginUserId).compose(RxHelper.<MsgListBean>rxSchedulerHelper());
    }
}
